﻿ If VersionLessThan 0.9.3
   Message "Um diese Mod installieren zu koennen wird OBMM Version 0.9.3 oder hoeher benoetigt um Skriptfehler zu vermeiden."
   FatalError
EndIf

SetVar Pre0Mod "Better Cities Full.esp"
SetVar Pre0aMod "Better Cities Full - B&M Edition.esp"
SetVar Pre1Mod ""
SetVar Pre2Mod ""
SetVar Pre3Mod ""
SetVar Pre4Mod ""
SetVar Pre5Mod ""
SetVar Pre6Mod ""
SetVar Pre6aMod ""
SetVar Pre7Mod ""
SetVar Pre8Mod "Better Cities IC Market.esp"
SetVar Pre9Mod "Better Cities IC Arboretum.esp"
SetVar icd0Mod "Better Imperial City.esp"
SetVar icd1Mod "Better Cities IC Arcane University.esp"
SetVar icd2Mod "Better Cities IC Arena.esp"
SetVar icd3Mod "Better Cities IC Elven Gardens.esp"
SetVar icd4Mod "Better Cities IC Green Emperor Way.esp"
SetVar icd5Mod "Better Cities IC Prison.esp"
SetVar icd6Mod "Better Cities IC Talos Plaza.esp"
SetVar icd7Mod "Better Cities IC Temple.esp"
SetVar icd8Mod "Better Cities IC Waterfront.esp"

;SetVar nam1Mod ""
SetVar nam2Mod "The Mystery of the Dulan cult.esp"
SetVar nam3Mod "Better Cities - Werewolf-Legends.esp"
SetVar nam4Mod "Better Cities - Old Crow Inn.esp"
SetVar nam5Mod "Better Cities - Vvardenfell Imports.esp"
SetVar nam6Mod "Slof's Oblivion Goth Shop.esp"
SetVar nam7Mod "Better Cities - Sexlivion.esp"
SetVar nam8Mod "Better Cities - Unique Landscape Chorrol Hinterland.esp"
SetVar nam9Mod "ClocksOfCyrodiil_BC_OBC_OC_OCLR_Vanilla.esp"
SetVar nam10Mod "VaultsofCyrodiilBC.esp"
SetVar nam11Mod "Scribe Supplies.esp"
SetVar nam12Mod "Better Cities - Knightly Armory.esp"
SetVar nam13Mod "Better Cities - Unique Landscape Barrowfields.esp"
SetVar nam14Mod "Better Cities - Halcyon Island.esp"
SetVar nam15Mod "Better Cities - COBL.esp"
SetVar nam16Mod "Better Cities - Tears of the Fiend.esp"
SetVar nam17Mod "Better Cities - No LEYAWIIN Flooding.esp"
SetVar nam18Mod "Better Cities - Ruined Tail's Tale.esp"
SetVar nam19Mod "Better Cities - TIE Restricted Area.esp"
SetVar nam20Mod "ICEXPAND.esp"
SetVar nam21Mod "Delivery Job - BC.esp"
SetVar nam22Mod "Better Cities - Valley View Estate.esp"
SetVar nam23Mod "TrailsOfCyrodiil-BC patch.esp"
SetVar nam24Mod "Better Cities - VHBloodlines.esp"
SetVar nam25Mod "Better Cities - Thievery.esp"
SetVar nam26Mod "Better Cities - Unique Landscape Cheydinhal Falls.esp"
SetVar nam27Mod "JolardHome.esp"
SetVar nam28Mod "Better Cities - Unique Landscape Skingrad Outskirts.esp"
SetVar nam29Mod "Better Cities - VWD of the IC.esp"
SetVar nam30Mod "Better Cities - Oblivion Collectible Cards.esp"
SetVar nam31Mod "Better Cities - Dwemer Subway.esp"
SetVar nam32Mod "Better Imperial City - OMG.esp"
SetVar nam33Mod "Better Cities - OMG.esp"
SetVar nam34Mod "Better Cities - Knights of the Nine.esp"
;SetVar nam35Mod ""
SetVar nam36Mod "Better Cities - CUO Chorrol Patch.esp"
;SetVar nam37Mod ""
;SetVar nam38Mod ""
SetVar nam39Mod "Better Cities B&M - CUO Bravil Patch.esp"
SetVar nam40Mod "Better Cities - CUO Bravil Patch.esp"
SetVar nam41Mod "Better Cities - CUO Leyawiin Patch.esp"
;SetVar nam42Mod ""
;SetVar nam43Mod ""
SetVar nam44Mod "Better Cities - CUO Bruma Patch.esp"
;SetVar nam45Mod ""
;SetVar nam46Mod ""
SetVar nam47Mod "Better Cities - The Lost Spires.esp"
SetVar nam48Mod "Better Cities - Skyrim Nords.esp"
SetVar nam49Mod "Better Cities - Skingrad Outer District.esp"
SetVar nam50Mod "Better Cities - Unique Landscape Imperial Isle.esp"
SetVar nam51Mod "Better Cities - All Natural.esp"
SetVar nam52Mod "Better Cities - Open Better Cities.esp"
AllowRunOnLines

DontInstallAnyPlugins
DontInstallAnyDataFiles

CopyPlugin "00 Core\\Better Cities Resources.esm" "Better Cities Resources.esm"

If DialogYesNo "Willst du die gemergten Plugins von Better Cities v5 installieren? Klicke Nein, wenn du die separaten Dateien fuer jeden einzelnen Bezirk installieren willst."
    If DataFileExists "Blood&Mud.esp"
        CopyPlugin "01 Unified\\Better Cities Full - B&M Edition.esp" %Pre0aMod%
        Message "Blood & Mud wurde erkannt, daher wird die Blood & Mud Edition installiert."
    Else
        CopyPlugin "01 Unified\\Better Cities Full.esp" %Pre0Mod%
    EndIf
    CopyPlugin "01 Unified\\Better Imperial City.esp" %icd0Mod%
    
    SetVar iPre0 1
    
        LoadAfter %icd0Mod% %Pre0aMod%
        LoadAfter %icd0Mod% %Pre0Mod%
Else
    If DataFileExists "Blood&Mud.esp"
        CopyPlugin "01 Unified\\Better Cities Full - B&M Edition.esp" %Pre0aMod%
        Message "Blood & Mud wurde erkannt, daher wird die Blood & Mud Edition installiert."
    Else
        CopyPlugin "01 Unified\\Better Cities Full.esp" %Pre0Mod%
    EndIf
    SelectMany "Waehle welche Kaiserstadt-Bezirke du installieren willst.", \
         "Baumgarten", \
         "Geheime Universitaet", \
         "Arenabezirk", \
         "Elfengarten-Bezirk", \
         "Palastbezirk", \
         "Marktbezirk", \
         "Gefaengnis", \
         "Talos-Platz-Bezirk", \
         "Tempelbezirk", \
         "Hafenbezirk"
        Case Baumgarten
            CopyPlugin "01 Separate\\Better Cities IC Arboretum.esp" %Pre9Mod%
            SetVar iPre9 1
        Break
        Case IC Geheime Universitaet
            CopyPlugin "01 Separate\\Better Cities IC Arcane University.esp" %icd1Mod%
            SetVar iICd1 1
        Break
        Case Arena
            CopyPlugin "01 Separate\\Better Cities IC Arena.esp" %icd2Mod%
            SetVar iICd2 1
        Break
        Case Elfengarten-Bezirk
            CopyPlugin "01 Separate\\Better Cities IC Elven Gardens.esp" %icd3Mod%
            SetVar iICd3 1
        Break
        Case Palastbezirk
            CopyPlugin "01 Separate\\Better Cities IC Green Emperor Way.esp" %icd4Mod%
            SetVar iICd4 1
        Break
        Case Marktbezirk
            CopyPlugin "01 Separate\\Better Cities IC Market.esp" %Pre8Mod%
            SetVar iPre8 1
        Break
        Case Gefaengnis
            CopyPlugin "01 Separate\\Better Cities IC Prison.esp" %icd5Mod%
            SetVar iICd5 1
        Break
        Case Talos-Platz-Bezirk
            CopyPlugin "01 Separate\\Better Cities IC Talos Plaza.esp" %icd6Mod%
            SetVar iICd6 1
       Break
        Case Tempelbezirk
            CopyPlugin "01 Separate\\Better Cities IC Temple.esp" %icd7Mod%
            SetVar iICd7 1
        Break
        Case Hafenbezirk
            CopyPlugin "01 Separate\\Better Cities IC Waterfront.esp" %icd8Mod%
            SetVar iICd8 1
        Break
    EndSelect
EndIf

;=============================================================================================
; 		FPS PATCHES                        
;=============================================================================================                        
If DialogYesNo "Willst du die FPS Patches installieren? Sie entfernen etwas von den neuen Inhalten und versuchen damit die FPS zu steigern."
    If Equal %iPre0% 1
        If DataFileExists "Blood&Mud.esp"
            CopyPlugin "40 FPS Patches\\Better Cities Full - B&M Edition FPS Patch.esp" "Better Cities Full - B&M Edition FPS Patch.esp"
            LoadAfter "Better Cities Full - B&M Edition FPS Patch.esp" %Pre0aMod%
        Else
            CopyPlugin "40 FPS Patches\\Better Cities Full FPS Patch.esp" "Better Cities Full FPS Patch.esp"
            LoadAfter "Better Cities Full FPS Patch.esp" %Pre0Mod%
        EndIf
        CopyPlugin "40 FPS Patches\\Better Imperial City FPS Patch.esp" "Better Imperial City FPS Patch.esp"
        LoadAfter "Better Imperial City FPS Patch.esp" %icd0Mod%
    Else
        If DataFileExists "Blood&Mud.esp"
            CopyPlugin "40 FPS Patches\\Better Cities Full - B&M Edition FPS Patch.esp" "Better Cities Full - B&M Edition FPS Patch.esp"
            LoadAfter "Better Cities Full - B&M Edition FPS Patch.esp" %Pre0aMod%
        Else
            CopyPlugin "40 FPS Patches\\Better Cities Full FPS Patch.esp" "Better Cities Full FPS Patch.esp"
            LoadAfter "Better Cities Full FPS Patch.esp" %Pre0Mod%
        EndIf	
        SelectMany "Waehle die FPS Patches, die du installieren willst.", \
         "Baumgarten", \
         "Geheime Universitaet", \
        "Elfengarten-Bezirk", \
        "Marktbezirk", \
        "Gefaengnis", \
        "Talos-Platz-Bezirk", \
        "Tempelbezirk", \
        "Hafentunnel", \
        "Hafenbezirk"
            Case Baumgarten
            	If Equal %iPre9% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Arboretum FPS Patch.esp" "Better Cities IC Arboretum FPS Patch.esp"
                	LoadAfter "Better Cities IC Arboretum FPS Patch.esp" %Pre9Mod%
                Else
                	Message "Du hast den Baumgarten-Bezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case IC Geheime Universitaet
            	If Equal %iICd1% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Arcane University FPS Patch.esp" "Better Cities IC Arcane University FPS Patch.esp"
                	LoadAfter "Better Cities IC Arcane University FPS Patch.esp" %icd1Mod%
                Else
                	Message "Du hast die Geheime Universitaet nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case IC Elfengarten-Bezirk
            	If Equal %iICd3% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Elven Gardens FPS Patch.esp" "Better Cities IC Elven Gardens FPS Patch.esp"
                	LoadAfter "Better Cities IC Elven Gardens FPS Patch.esp" %icd3Mod%
                Else
                	Message "Du hast den Elfengarten-Bezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case Marktbezirk
            	If Equal %iPre8% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Market FPS Patch.esp" "Better Cities IC Market FPS Patch.esp"
                	LoadAfter "Better Cities IC Market FPS Patch.esp" %Pre8Mod%
                Else
                	Message "Du hast den Marktbezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case Gefaengnis
            	If Equal %iICd5% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Prison FPS Patch.esp" "Better Cities IC Prison FPS Patch.esp"
                	LoadAfter "Better Cities IC Prison FPS Patch.esp" %icd5Mod%
                Else
                	Message "Du hast das Gefaengnis nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case Talos-Platz-Bezirk
            	If Equal %iICd6% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Talos Plaza FPS Patch.esp" "Better Cities IC Talos Plaza FPS Patch.esp"
                	LoadAfter "Better Cities IC Talos Plaza FPS Patch.esp" %icd6Mod%
                Else
                	Message "Du hast den Talos-Platz-Bezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case Tempelbezirk
            	If Equal %iICd7% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Temple FPS Patch.esp" "Better Cities IC Temple FPS Patch.esp"
                	LoadAfter "Better Cities IC Temple FPS Patch.esp" %icd7Mod%
                Else
                	Message "Du hast den Tempelbezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
            Case Hafentunnel
                CopyPlugin "40 FPS Patches\\Better Cities IC Tunnel FPS Patch.esp" "Better Cities IC Tunnel FPS Patch.esp"
            Break
            Case Hafenbezirk
            	If Equal %iICd8% 1
                	CopyPlugin "40 FPS Patches\\Better Cities IC Waterfront FPS Patch.esp" "Better Cities IC Waterfront FPS Patch.esp"
                	LoadAfter "Better Cities IC Waterfront FPS Patch.esp" %icd8Mod%
                Else
                	Message "Du hast den Hafenbezirk nicht installiert, daher brauchst du diesen FPS Patch nicht."
                EndIf
            Break
        EndSelect
    EndIf
Else
    Message "Es werden keine FPS Patches installiert."
EndIf
            
;=============================================================================================                        
;        OPTIONAL PLUGINS (REPALCERS)
;=============================================================================================                        
SelectManyWithDescriptions "Replacers Plugins - Waehle nur die Mods aus der Liste, die du bereits installiert hast.", \
        "Slof's Goth Shop", "Ersetzt das original Plugin um die Kompatibilitaet zu fixen. Du musst die Originalmod downloaden und installieren. Es wird geprueft ob du die Mod tatsaechlich installiert hast.", \
        "Mystery of the Dulan Cult", "Replacer Plugin. Du musst die Originalmod downloaden und installieren. Es wird geprueft ob du die Mod tatsaechlich installiert hast.", \
        "Clocks of Cyrodiil", "Replacer Plugin des originalen Clocks of Cyrodiil. Du musst die Originalmod downloaden und installieren. Es wird geprueft ob du die Mod tatsaechlich installiert hast.", \
        "IC Expanded", "Replacer Plugin des originalen IC Expanded von Captain Chris Stc. Du musst die Originalmod downloaden und installieren. Es wird geprueft ob du die Mod tatsaechlich installiert hast.", \
        "Scribe Supplies", "Waehle zwischen den zwei Plugins fuer Scribe Supplies nachdem du auf OK geklickt hast. Die Standard Version fuegt Dinge zum Verkauf fuer die Buecherhändlern hinzu. Die Intense Version fuegt ausserdem Dinge in verschiedenen NPC-Haeusern und Gildenhallen hinzu. Es werden keine weiteren Ressourcen benoetigt.", \
        "Vaults of Cyrodiil", "Replacer Plugin. Da es keine Ressourcen fuer diese Mod gibt, musst du auch nicht die Originalmod herunterladen, ausser um die Readme zu lesen.", \
        "Against Zealots of the Nine", "Ersetzt das original Plugin um die Kompatibilitaet zu fixen. Du musst die Originalmod downloaden und installieren. Es wird geprueft ob du die Mod tatsaechlich installiert hast.", \
        "Keine", "Du willst keine dieser Plugins."
;=============================================================================================                        
    Case Slof's Goth Shop
        If DataFileExists "meshes\\clutter\\asgothshop1\\asgoth1handofgothsign.nif"
            CopyPlugin "20 Slofs Goth Shop\\Slof's Oblivion Goth Shop.esp" %nam6Mod%
                LoadBefore %nam6Mod% %Pre0Mod%
                LoadBefore %nam6Mod% %Pre0aMod%
                LoadBefore %nam6Mod% %icd0Mod%
        Else
            Message "Du musst die Original Slof's Oblivion Goth Shop I und II installieren, ueberschreibe das Original und verwende nur diese ESP (nicht die Beta)."
        EndIf
    Break
;=============================================================================================                        
    Case Mystery of the Dulan Cult
        If DataFileExists "Meshes\\pheaddoor\\metatrondoor.nif"
            CopyPlugin "20 Mystery of the Dulan Cult\\The Mystery of the Dulan cult.esp" %nam2Mod%
                LoadBefore %nam2Mod% %icd0Mod%
                LoadBefore %nam2Mod% %Pre8Mod%
        Else
            Message "Du musst die originale Mystery of the Dulan Cult Mod installieren um diesen Replacer verwenden zu koennen."
        EndIf
    Break
;=============================================================================================                        
    Case Clocks of Cyrodiil
        If DataFileExists "Sound\\fx\\ambient\\clock\\ClockChimes0.wav"
            CopyPlugin "20 Clocks of Cyrodiil\\ClocksOfCyrodiil_BC_OBC_OC_OCLR_Vanilla.esp" %nam9Mod%
                LoadBefore %nam9Mod% %Pre0Mod%
                LoadBefore %nam9Mod% %Pre0aMod%
                LoadBefore %nam9Mod% %icd0Mod%
                LoadBefore %nam9Mod% %Pre8Mod%
                LoadBefore %nam9Mod% %Pre9Mod%
        Else
            Message "Du musst die originale Clocks of Cyrodiil Mod installieren um diesen Replacer verwenden zu koennen."
        EndIf
    Break
;=============================================================================================                        
    Case IC Expanded
        If DataFileExists "meshes\\ICEXPAND\\ICEXPPlaneSign.nif"
            CopyPlugin "20 ICExpand\\ICEXPAND.esp" %nam20Mod%
            If Equal %iPre0% 1
                LoadBefore %nam20Mod% %icd0Mod%
            Else
                LoadBefore %nam20Mod% %Pre8Mod%
                LoadBefore %nam20Mod% %Pre9Mod%
                LoadBefore %nam20Mod% %icd0Mod%
                LoadBefore %nam20Mod% %icd1Mod%
                LoadBefore %nam20Mod% %icd2Mod%
                LoadBefore %nam20Mod% %icd3Mod%
                LoadBefore %nam20Mod% %icd4Mod%
                LoadBefore %nam20Mod% %icd5Mod%
                LoadBefore %nam20Mod% %icd6Mod%
                LoadBefore %nam20Mod% %icd7Mod%
                LoadBefore %nam20Mod% %icd8Mod%
            EndIf
        Else
            Message "Du musst die originale ICExpand Mod installieren um diesen Replacer verwenden zu koennen."
        EndIf
    Break
;=============================================================================================                        
    Case Scribe Supplies
        If Equal %iPre0% 1
            If DialogYesNo "Willst du die Intensive Version von Scribe Supplies (die viele Zellen aendert)?"
                CopyPlugin "20 Scribe Supplies\\00RBScribeSupplies Intensive.esp" %nam11Mod%
            Else
                CopyPlugin "20 Scribe Supplies\\00RBScribeSupplies02, read summary.esp" %nam11Mod%
            EndIf
            LoadBefore %nam11Mod% %Pre0Mod%
            LoadBefore %nam11Mod% %Pre0aMod%
            LoadBefore %nam11Mod% %icd0Mod%
        Else
            If Equal %iPre8% 1
                If DialogYesNo "Willst du die Intensive Version von Scribe Supplies (die viele Zellen aendert)?"
                    CopyPlugin "20 Scribe Supplies\\00RBScribeSupplies Intensive.esp" %nam11Mod%
                Else
                    CopyPlugin "20 Scribe Supplies\\00RBScribeSupplies02, read summary.esp" %nam11Mod%
                EndIf
                LoadBefore %nam11Mod% %Pre8Mod%
            Else
                Message "Weder Better Cities Full noch IC Market sind installiert, daher brauchst du den Scribe Supplies Replacer nicht."
            EndIf
        EndIf
    Break
;=============================================================================================                        
    Case Vaults of Cyrodiil
        CopyPlugin "20 Vaults Of Cyrodiil\\VaultsofCyrodiilBC.esp" %nam10Mod%
        LoadBefore %nam10Mod% %Pre0Mod%
        LoadBefore %nam10Mod% %Pre0aMod%
        LoadBefore %nam10Mod% %icd0Mod%
    Break
;=============================================================================================                        
    Case Against Zealots of the Nine
    	If DataFileExists "Sound\\Voice\\JolardHome.esp\\Imperial\\F\\JolardEscortQuest_GREETING_00004F9D_1.mp3"
        	CopyPlugin "20 Against the Zealots of the Nine\\JolardHome.esp" %nam27Mod%
        Else
        	Message "Du musst die originale Against the Zealots of the Nine Mod installieren um diesen Replacer verwenden zu koennen."
        EndIf
        LoadBefore %nam27Mod% %Pre0Mod%
        LoadBefore %nam27Mod% %Pre0aMod%
        LoadBefore %nam27Mod% %icd0Mod%
        LoadBefore %nam27Mod% %Pre8Mod%
        LoadBefore %nam27Mod% %Pre9Mod%
        LoadBefore %nam27Mod% %icd1Mod%
        LoadBefore %nam27Mod% %icd2Mod%
        LoadBefore %nam27Mod% %icd3Mod%
        LoadBefore %nam27Mod% %icd4Mod%
        LoadBefore %nam27Mod% %icd5Mod%
        LoadBefore %nam27Mod% %icd6Mod%
        LoadBefore %nam27Mod% %icd7Mod%
        LoadBefore %nam27Mod% %icd8Mod%
    Break
;=============================================================================================                        
    Case None
        Message "Es werden keine Replacer installiert."
    Break
EndSelect
;=============================================================================================                        

;=============================================================================================    
;		PATCHES    
;=============================================================================================    
;All Natual
        If DataFileExists "All Natural.esp"
            CopyPlugin "30 All Natural\\Better Cities - All Natural.esp" %nam51Mod%
            CopyDataFolder "30 All Natural\\Meshes" "Meshes" True
                LoadAfter %nam51Mod% %Pre0Mod%
                LoadAfter %nam51Mod% %Pre0aMod%
                LoadAfter %nam51Mod% %icd0Mod%
        EndIf
;=============================================================================================    
;UL Chorrol Hinterland
        If DataFileExists "Meshes\\Signposts\\ChorrolMiningCompanySign.nif"
            CopyPlugin "30 UL Chorrol Hinterlands\\Better Cities - Unique Landscape Chorrol Hinterland.esp" %nam8Mod%
                LoadAfter %nam8Mod% %Pre0Mod%
                LoadAfter %nam8Mod% %Pre0aMod%
                LoadAfter %nam8Mod% %icd0Mod%
                LoadAfter %nam8Mod% %icd8Mod%
        EndIf
;=============================================================================================    
;UL Bravil BarrowFileds
    If DataFileExists "xulBravilBarrowfields.esp"
        If DataFileExists "Blood&Mud.esp"
            CopyPlugin "31 UL Bravil Barrowfields\\Better Cities B&M - Unique Landscape Barrowfields.esp" %nam13Mod%
            LoadAfter %nam13Mod% %Pre0aMod%
        Else
            CopyPlugin "31 UL Bravil Barrowfields\\Better Cities - Unique Landscape Barrowfields.esp" %nam13Mod%
            LoadAfter %nam13Mod% %Pre0Mod%
        EndIf
    EndIf
;=============================================================================================                        
;Old Crow Inn
        If DataFileExists "OldCrowInn.esp"
            CopyPlugin "30 Old Crow Inn\\Better Cities - Old Crow Inn.esp" %nam4Mod%
                LoadAfter %nam4Mod% %Pre0Mod%
                LoadAfter %nam4Mod% %Pre0aMod%
                LoadAfter %nam4Mod% %icd0Mod%
                LoadAfter %nam4Mod% %Pre8Mod%
                LoadAfter %nam4Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Knightly Armory
        If DataFileExists "KnightlyArmory.esp"
            CopyPlugin "30 Knightly Armory\\Better Cities - Knightly Armory.esp" %nam12Mod%
                LoadAfter %nam12Mod% %Pre0Mod%
            	LoadAfter %nam12Mod% %Pre0aMod%
                LoadAfter %nam12Mod% %icd0Mod%
                LoadAfter %nam12Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Dall's Skyrim Nords
        If DataFileExists "Dalls_SkyrimNords.esp"
            CopyPlugin "30 Skyrim Nords\\Better Cities - Skyrim Nords.esp" %nam48Mod%
            LoadAfter %nam48Mod% %Pre0Mod%
            LoadAfter %nam48Mod% %Pre0aMod%
            LoadAfter %nam48Mod% %Pre8Mod%
            LoadAfter %nam48Mod% %Pre9Mod%
            LoadAfter %nam48Mod% %icd0Mod%
            LoadAfter %nam48Mod% %icd1Mod%
            LoadAfter %nam48Mod% %icd2Mod%
            LoadAfter %nam48Mod% %icd3Mod%
            LoadAfter %nam48Mod% %icd4Mod%
            LoadAfter %nam48Mod% %icd5Mod%
            LoadAfter %nam48Mod% %icd6Mod%
            LoadAfter %nam48Mod% %icd7Mod%
            LoadAfter %nam48Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Halcyon Island
        If DataFileExists "Halcyon Island.esp"
            CopyPlugin "30 Halcyon Island\\Better Cities - Halcyon Island.esp" %nam14Mod%
            LoadAfter %nam14Mod% %Pre0Mod%
            LoadAfter %nam14Mod% %Pre0aMod%
            LoadAfter %nam14Mod% %Pre8Mod%
            LoadAfter %nam14Mod% %Pre9Mod%
            LoadAfter %nam14Mod% %icd0Mod%
            LoadAfter %nam14Mod% %icd1Mod%
            LoadAfter %nam14Mod% %icd2Mod%
            LoadAfter %nam14Mod% %icd3Mod%
            LoadAfter %nam14Mod% %icd4Mod%
            LoadAfter %nam14Mod% %icd5Mod%
            LoadAfter %nam14Mod% %icd6Mod%
            LoadAfter %nam14Mod% %icd7Mod%
            LoadAfter %nam14Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Tears of the Fiend
        If DataFileExists "TOTF.esp"
            CopyPlugin "30 Tears of the Fiend\\Better Cities - Tears of the Fiend.esp" %nam16Mod%
            LoadAfter %nam16Mod% %Pre0Mod%
            LoadAfter %nam16Mod% %Pre0aMod%
            LoadAfter %nam16Mod% %Pre8Mod%
            LoadAfter %nam16Mod% %Pre9Mod%
            LoadAfter %nam16Mod% %icd0Mod%
            LoadAfter %nam16Mod% %icd1Mod%
            LoadAfter %nam16Mod% %icd2Mod%
            LoadAfter %nam16Mod% %icd3Mod%
            LoadAfter %nam16Mod% %icd4Mod%
            LoadAfter %nam16Mod% %icd5Mod%
            LoadAfter %nam16Mod% %icd6Mod%
            LoadAfter %nam16Mod% %icd7Mod%
            LoadAfter %nam16Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Werewolf Legends of the North
        If DataFileExists "Werewolf-Legends.esp"
            CopyPlugin "30 Werewolf Legends\\Better Cities - Werewolf-Legends.esp" %nam3Mod%
                LoadAfter %nam3Mod% %Pre0Mod%
                LoadAfter %nam3Mod% %Pre0aMod%
        EndIf
;=============================================================================================                        
;Ruined Tail's Tale
        If DataFileExists "RTT.esp"
            CopyPlugin "30 Ruined Tails Tale\\Better Cities - Ruined Tail's Tale.esp" %nam18Mod%
                LoadAfter %nam18Mod% %Pre0Mod%
            	LoadAfter %nam18Mod% %Pre0aMod%
                LoadAfter %nam18Mod% %Pre8Mod%
                LoadAfter %nam18Mod% %Pre9Mod%
                LoadAfter %nam18Mod% %icd0Mod%
                LoadAfter %nam18Mod% %icd1Mod%
                LoadAfter %nam18Mod% %icd2Mod%
                LoadAfter %nam18Mod% %icd3Mod%
                LoadAfter %nam18Mod% %icd4Mod%
                LoadAfter %nam18Mod% %icd5Mod%
                LoadAfter %nam18Mod% %icd6Mod%
                LoadAfter %nam18Mod% %icd7Mod%
                LoadAfter %nam18Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Valley View Estate
        If DataFileExists "sound\\voice\\Valley_View_Estate.esp\\Argonier\\F\\VVVQuest_VVVFamilyStandAround_0000E21C_1.mp3"
            If Equal %iPre0% 1
                CopyPlugin "30 Valley View Estate\\Better Cities - Valley View Estate.esp" %nam22Mod%
            Else
                If Equal %iPre5% 1
                    CopyPlugin "30 Valley View Estate\\Better Cities - Valley View Estate.esp" %nam22Mod%
                EndIf
            EndIf
                LoadAfter %nam22Mod% %Pre0Mod%
                LoadAfter %nam22Mod% %Pre0aMod%
                LoadAfter %nam22Mod% %Pre8Mod%
                LoadAfter %nam22Mod% %Pre9Mod%
                LoadAfter %nam22Mod% %icd0Mod%
                LoadAfter %nam22Mod% %icd1Mod%
                LoadAfter %nam22Mod% %icd2Mod%
                LoadAfter %nam22Mod% %icd3Mod%
                LoadAfter %nam22Mod% %icd4Mod%
                LoadAfter %nam22Mod% %icd5Mod%
                LoadAfter %nam22Mod% %icd6Mod%
                LoadAfter %nam22Mod% %icd7Mod%
                LoadAfter %nam22Mod% %icd8Mod%
        EndIf
        
;=============================================================================================                        
;Verona House Bloodlines
        If DataFileExists "VHBloodlines 1.2.esp"
            CopyPlugin "30 Verona House Bloodlines\\Better Cities - VHBloodlines.esp" %nam24Mod%
                LoadAfter %nam24Mod% %Pre0Mod%
                LoadAfter %nam24Mod% %Pre0aMod%
                LoadAfter %nam24Mod% %Pre8Mod%
                LoadAfter %nam24Mod% %Pre9Mod%
                LoadAfter %nam24Mod% %icd0Mod%
                LoadAfter %nam24Mod% %icd1Mod%
                LoadAfter %nam24Mod% %icd2Mod%
                LoadAfter %nam24Mod% %icd3Mod%
                LoadAfter %nam24Mod% %icd4Mod%
                LoadAfter %nam24Mod% %icd5Mod%
                LoadAfter %nam24Mod% %icd6Mod%
                LoadAfter %nam24Mod% %icd7Mod%
                LoadAfter %nam24Mod% %icd8Mod%
        EndIf
        
;=============================================================================================                        
;Trails Of Cyrodiil
        If DataFileExists "Trail  EAST.esp"
         	If DataFileExists "xulCheydinhalFalls.esp"
         		Message "Installiere den Patch von Chaky fuer UL Cheydinhal Falls"
         	Else
            	CopyPlugin "30 Trails Of Cyrodiil\\TrailsOfCyrodiil-BC patch.esp" %nam23Mod%
            		LoadAfter %nam23Mod% %Pre0Mod%
                	LoadAfter %nam23Mod% %Pre0aMod%
            EndIf
        EndIf   
;=============================================================================================                        
;Vvardenfell Imports
        If DataFileExists "Vvardenfell_Imports.esp"
         	CopyPlugin "30 Vvardenfell Imports\\Better Cities - Vvardenfell Imports.esp" %nam5Mod%
            	LoadAfter %nam5Mod% %Pre0Mod%
                LoadAfter %nam5Mod% %Pre0aMod%
        EndIf
;=============================================================================================                        
;Thievery in the Imperial City
        If DataFileExists "Thievery.esp"
            CopyPlugin "30 Thievery in the Imperial City\\Better Cities - Thievery.esp" %nam25Mod%
                LoadAfter %nam25Mod% %Pre0Mod%
                LoadAfter %nam25Mod% %Pre0aMod%
                LoadAfter %nam25Mod% %Pre8Mod%
                LoadAfter %nam25Mod% %Pre9Mod%
                LoadAfter %nam25Mod% %icd0Mod%
                LoadAfter %nam25Mod% %icd1Mod%
                LoadAfter %nam25Mod% %icd2Mod%
                LoadAfter %nam25Mod% %icd3Mod%
                LoadAfter %nam25Mod% %icd4Mod%
                LoadAfter %nam25Mod% %icd5Mod%
                LoadAfter %nam25Mod% %icd6Mod%
                LoadAfter %nam25Mod% %icd7Mod%
                LoadAfter %nam25Mod% %icd8Mod%
        EndIf
        
;=============================================================================================
;UL Cheydinhal Falls
    If DataFileExists "xulCheydinhalFalls.esp"
        CopyPlugin "30 UL Cheydinhal Falls\\Better Cities - Unique Landscape Cheydinhal Falls.esp" %nam26Mod%
                LoadAfter %nam26Mod% %Pre0Mod%
                LoadAfter %nam26Mod% %Pre0aMod%
                LoadAfter %nam26Mod% %Pre8Mod%
                LoadAfter %nam26Mod% %Pre9Mod%
                LoadAfter %nam26Mod% %icd0Mod%
                LoadAfter %nam26Mod% %icd1Mod%
                LoadAfter %nam26Mod% %icd2Mod%
                LoadAfter %nam26Mod% %icd3Mod%
                LoadAfter %nam26Mod% %icd4Mod%
                LoadAfter %nam26Mod% %icd5Mod%
                LoadAfter %nam26Mod% %icd6Mod%
                LoadAfter %nam26Mod% %icd7Mod%
                LoadAfter %nam26Mod% %icd8Mod%
    EndIf

;=============================================================================================
;UL Imperial Isle
    If DataFileExists "xulImperialIsle.esp"
        CopyPlugin "30 UL Imperial Isle\\Better Cities - Unique Landscape Imperial Isle.esp" %nam50Mod%
                LoadAfter %nam50Mod% %Pre0Mod%
                LoadAfter %nam50Mod% %Pre0aMod%
                LoadAfter %nam50Mod% %Pre8Mod%
                LoadAfter %nam50Mod% %Pre9Mod%
                LoadAfter %nam50Mod% %icd0Mod%
                LoadAfter %nam50Mod% %icd1Mod%
                LoadAfter %nam50Mod% %icd2Mod%
                LoadAfter %nam50Mod% %icd3Mod%
                LoadAfter %nam50Mod% %icd4Mod%
                LoadAfter %nam50Mod% %icd5Mod%
                LoadAfter %nam50Mod% %icd6Mod%
                LoadAfter %nam50Mod% %icd7Mod%
                LoadAfter %nam50Mod% %icd8Mod%
    EndIf

;=============================================================================================
;Skingrad Outer District
    If DataFileExists "Skingrad outer district.esp"
    	CopyPlugin "30 Skingrad Outer District\\Better Cities - Skingrad Outer District.esp" %nam49Mod%
                LoadAfter %nam49Mod% %Pre0Mod%
                LoadAfter %nam49Mod% %Pre0aMod%
                LoadAfter %nam49Mod% %Pre8Mod%
                LoadAfter %nam49Mod% %Pre9Mod%
                LoadAfter %nam49Mod% %icd0Mod%
                LoadAfter %nam49Mod% %icd1Mod%
                LoadAfter %nam49Mod% %icd2Mod%
                LoadAfter %nam49Mod% %icd3Mod%
                LoadAfter %nam49Mod% %icd4Mod%
                LoadAfter %nam49Mod% %icd5Mod%
                LoadAfter %nam49Mod% %icd6Mod%
                LoadAfter %nam49Mod% %icd7Mod%
                LoadAfter %nam49Mod% %icd8Mod%
    EndIf
;=============================================================================================
;UL Skingrad Outskirts
    If DataFileExists "xulSkingradOutskirts.esp"
       CopyPlugin "30 UL Skingrad Outskirts\\Better Cities - Unique Landscape Skingrad Outskirts.esp" %nam28Mod%
                LoadAfter %nam28Mod% %Pre0Mod%
                LoadAfter %nam28Mod% %Pre0aMod%
                LoadAfter %nam28Mod% %Pre8Mod%
                LoadAfter %nam28Mod% %Pre9Mod%
                LoadAfter %nam28Mod% %icd0Mod%
                LoadAfter %nam28Mod% %icd1Mod%
                LoadAfter %nam28Mod% %icd2Mod%
                LoadAfter %nam28Mod% %icd3Mod%
                LoadAfter %nam28Mod% %icd4Mod%
                LoadAfter %nam28Mod% %icd5Mod%
                LoadAfter %nam28Mod% %icd6Mod%
                LoadAfter %nam28Mod% %icd7Mod%
                LoadAfter %nam28Mod% %icd8Mod%
    EndIf
;=============================================================================================
;Sexlivion
    If DataFileExists "Sexlivion.esp"
            CopyPlugin "32 Sexlivion\\Better Cities - Sexlivion.esp" %nam7Mod%
            LoadAfter %nam7Mod% %icd0Mod%
            LoadAfter %nam7Mod% %Pre8Mod%
    Else
    	If DataFileExists "Sexlivion_0.4a_Full_English_v1.esp"
            CopyPlugin "32 Sexlivion\\Better Cities - Sexlivion_0.4a_Full_English_v1.esp" %nam7Mod%
           	LoadAfter %nam7Mod% %icd0Mod%
            LoadAfter %nam7Mod% %Pre8Mod%
    	EndIf
    EndIf
;=============================================================================================
;Origin of the Mage's Guild
    If DataFileExists "Origin of the Mages Guild.esp"
    	If Equal %iPre0% 1
            CopyPlugin "33 Origin of the Mages Guild\\Better Imperial City - OMG.esp" %nam32Mod%
            LoadAfter %nam7Mod% %icd0Mod%
    	Else
            CopyPlugin "33 Origin of the Mages Guild\\Better Cities - OMG.esp" %nam33Mod%
           	LoadAfter %nam7Mod% %Pre8Mod%
            LoadAfter %nam7Mod% %icd1Mod%
    	EndIf
    EndIf
;=============================================================================================
;CUO Chorrol Patch
    If DataFileExists "CUO_Chorrol.esp"
    	CopyPlugin "33 CUO Chorrol\\Better Cities - CUO Chorrol Patch.esp" %nam36Mod%
            LoadAfter %nam36Mod% %Pre0aMod%
            LoadAfter %nam36Mod% %Pre0Mod%
    EndIf
;=============================================================================================
;CUO Bruma Patch
    If DataFileExists "CUO_Bruma.esp"
    	CopyPlugin "33 CUO Bruma\\Better Cities - CUO Bruma Patch.esp" %nam44Mod%
        LoadAfter %nam444Mod% %Pre0aMod%
        LoadAfter %nam444Mod% %Pre0Mod%
    EndIf
;=============================================================================================
;CUO Leyawiin Patch
    If DataFileExists "CUO_Leyawiin.esp"
    	CopyPlugin "33 CUO Leyawiin\\Better Cities - CUO Leyawiin Patch.esp" %nam41Mod%
        LoadAfter %nam41Mod% %Pre0Mod%
        LoadAfter %nam41Mod% %Pre0aMod%
    EndIf
;=============================================================================================
;CUO Bravil Patch
    If DataFileExists "CUO_Bravil.esp"
    	If DataFileExists "Blood&Mud.esp"
            CopyPlugin "33 CUO Bravil\\Better Cities B&M - CUO Bravil Patch.esp" %nam39Mod%
            LoadAfter %nam39Mod% %Pre0aMod%
        Else
            CopyPlugin "33 CUO Bravil\\Better Cities - CUO Bravil Patch.esp" %nam40Mod%
            LoadAfter %nam40Mod% %Pre0Mod%
        EndIf
    EndIf
;=============================================================================================                        
;Oblivion Collectible Cards
        If DataFileExists "Oblivion Collectible Cards.esp"
            CopyPlugin "30 Oblivion Collectible Cards\\Better Cities - Oblivion Collectible Cards.esp" %nam30Mod%
                LoadAfter %nam30Mod% %Pre0Mod%
                LoadAfter %nam30Mod% %Pre0aMod%
                LoadAfter %nam30Mod% %Pre8Mod%
                LoadAfter %nam30Mod% %Pre9Mod%
                LoadAfter %nam30Mod% %icd0Mod%
                LoadAfter %nam30Mod% %icd1Mod%
                LoadAfter %nam30Mod% %icd2Mod%
                LoadAfter %nam30Mod% %icd3Mod%
                LoadAfter %nam30Mod% %icd4Mod%
                LoadAfter %nam30Mod% %icd5Mod%
                LoadAfter %nam30Mod% %icd6Mod%
                LoadAfter %nam30Mod% %icd7Mod%
                LoadAfter %nam30Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Oblivion Mr Siika Dwemer Technology
        If DataFileExists "mrSiikas_DwemerTechnology_DwemerSubway.esp"
            CopyPlugin "30 Dwemer Subway\\Better Cities - Dwemer Subway.esp" %nam31Mod%
                LoadAfter %nam31Mod% %Pre0Mod%
                LoadAfter %nam31Mod% %Pre0aMod%
                LoadAfter %nam31Mod% %Pre8Mod%
                LoadAfter %nam31Mod% %Pre9Mod%
                LoadAfter %nam31Mod% %icd0Mod%
                LoadAfter %nam31Mod% %icd1Mod%
                LoadAfter %nam31Mod% %icd2Mod%
                LoadAfter %nam31Mod% %icd3Mod%
                LoadAfter %nam31Mod% %icd4Mod%
                LoadAfter %nam31Mod% %icd5Mod%
                LoadAfter %nam31Mod% %icd6Mod%
                LoadAfter %nam31Mod% %icd7Mod%
                LoadAfter %nam31Mod% %icd8Mod%
        EndIf
;=============================================================================================                        
;Oblivion The Lost Spires
        If DataFileExists "The Lost Spires.esp"
            CopyPlugin "30 The Lost Spires\\Better Cities - The Lost Spires.esp" %nam47Mod%
                LoadAfter %nam47Mod% %Pre0Mod%
                LoadAfter %nam47Mod% %Pre0aMod%
        EndIf
;=============================================================================================   

;============================================================================================= 
; INTEGRATION  PATCHES
;=============================================================================================                        
;COBL drinkable wells & Ingredients
        If DataFileExists "COBL Main.esm"
        	If DialogYesNo "Willst du die COBL Integrationsdatei verwenden? (Wird NICHT benoetigt, auch wenn man COBL verwendet): Die Brunnen, die von BC in jeder Stadt hinzugefuegt werden, koennen als Wasserquelle zum Trinken verwendet werden, wenn man den Survival-Teil von COBL benutzt, und diverse BC Zutaten werden wie COBL Zutaten behandelt."
            	CopyPlugin "10 Cobl\\Better Cities - COBL.esp" %nam15Mod%
		            LoadAfter %nam15Mod% %Pre0Mod%
		            LoadAfter %nam15Mod% %Pre0aMod%
		            LoadAfter %nam15Mod% %Pre8Mod%
		            LoadAfter %nam15Mod% %Pre9Mod%
		            LoadAfter %nam15Mod% %icd0Mod%
		            LoadAfter %nam15Mod% %icd1Mod%
		            LoadAfter %nam15Mod% %icd2Mod%
		            LoadAfter %nam15Mod% %icd3Mod%
		            LoadAfter %nam15Mod% %icd4Mod%
		            LoadAfter %nam15Mod% %icd5Mod%
		            LoadAfter %nam15Mod% %icd6Mod%
		            LoadAfter %nam15Mod% %icd7Mod%
		            LoadAfter %nam15Mod% %icd8Mod%
            Else
            	Message "Der COBL Integrationspatch wird nicht installiert."
            EndIf
        EndIf                     
;=============================================================================================                        
;TIE Resctricted Areas
        If DataFileExists "TIE.esp"
        	If DialogYesNo "Willst du die TIE Integrationsdatei verwenden? (Wird NICHT benoetigt, auch wenn man TIE verwendet): In einigen Gebieten von Better Cities wirst du beschraenkten Zugang haben, so wie es in TIE ist. Das bedeutet, du wirst nicht autorisiert sein sie zu betreten, wenn ein NPC anwesend ist."
            	CopyPlugin "10 TIE\\Better Cities - TIE Restricted Area.esp" %nam19Mod%
	                LoadAfter %nam19Mod% %Pre0Mod%
	            	LoadAfter %nam19Mod% %Pre0aMod%
	                LoadAfter %nam19Mod% %Pre8Mod%
	                LoadAfter %nam19Mod% %Pre9Mod%
	                LoadAfter %nam19Mod% %icd0Mod%
	                LoadAfter %nam19Mod% %icd1Mod%
	                LoadAfter %nam19Mod% %icd2Mod%
	                LoadAfter %nam19Mod% %icd3Mod%
	                LoadAfter %nam19Mod% %icd4Mod%
	                LoadAfter %nam19Mod% %icd5Mod%
	                LoadAfter %nam19Mod% %icd6Mod%
	                LoadAfter %nam19Mod% %icd7Mod%
	                LoadAfter %nam19Mod% %icd8Mod%
	         Else
	         	Message "Der TIE Integrationspatch wird nicht installiert."
	         EndIf
        EndIf
;=============================================================================================                        

;=============================================================================================
; OTHER CUSTOMOZATIONS
;=============================================================================================
If DialogYesNo "Willst du die Better Cities View When Distant Items der Kaiserstadt sehen? (Senkt FPS)"
	CopyPlugin "04 View When Distant IC\\Better Cities - VWD of the IC.esp" %nam29Mod%
	LoadAfter %nam29Mod% %icd0Mod%
	LoadAfter %nam29Mod% %icd1Mod%
	LoadAfter %nam29Mod% %icd2Mod%
	LoadAfter %nam29Mod% %icd3Mod%
	LoadAfter %nam29Mod% %icd4Mod%
	LoadAfter %nam29Mod% %icd5Mod%
	LoadAfter %nam29Mod% %icd6Mod%
	LoadAfter %nam29Mod% %icd7Mod%
	LoadAfter %nam29Mod% %icd8Mod%
	LoadAfter %nam29Mod% %Pre8Mod%
	LoadAfter %nam29Mod% %Pre9Mod%
Else
	Message "Du wirst die Better Cities VWD Items der Kaiserstadt nicht sehen."
EndIf

;=============================================================================================                        
If DialogYesNo "Moechtest du die Flut in Leyawiin entfernen?(senkt den Wasserspiegel und entfernt die Plankenwege)"
        CopyPlugin "03 Leyawiin Flood Removal\\Better Cities - No LEYAWIIN Flooding.esp" %nam17Mod%
        LoadAfter %nam17Mod% %Pre0Mod%
        LoadAfter %nam17Mod% %Pre0aMod%
        LoadAfter %nam17Mod% %icd0Mod%
Else
    Message "Der Wasserspiegel in Leyawiin bleibt so wie es Bananasplit vorgesehen hat."
EndIf
;=============================================================================================                        
If DialogYesNo "Hast du vor, die Open Better Cities Option zu verwenden? Wenn du auf Ja klickst, wird das Open Better Cities Plugin installiert."
    CopyPlugin "05 Open Better Cities\\Better Cities - Open Better Cities.esp" %nam52Mod%
        LoadAfter %nam52Mod% %Pre0Mod%
        LoadAfter %nam52Mod% %Pre0aMod%
        LoadAfter %nam52Mod% %icd0Mod%
    If DataFileExists "Knights.esp"
    	CopyPlugin "30 Knights of the Nine\\Better Cities - Knights of the Nine.esp" %nam34Mod%
        LoadAfter %nam34Mod% %Pre0Mod%
        LoadAfter %nam34Mod% %Pre0aMod%
        LoadAfter %nam34Mod% %icd0Mod%
    EndIf
Else
    Message "Die Vanilla Edits der NPCs und Quests fuer die Open Cities Option von Better Cities wird nicht installiert."
EndIf
;=============================================================================================                        

Message "Installiere die Better Cities Ressources Packs (beide) damit Better Cities fehlerfrei dargestellt werden kann."